﻿Imports Microsoft.VisualBasic

Namespace LightSwitchApplication

    Public Class DisposedAsset

        Private Sub DisposalAccmDeprDisplay_Compute(ByRef result As Decimal)
            'Dim depreciationYears As Integer = 0
            'If MainAssetsTable.Category Is Nothing Then
            '    depreciationYears = 0
            'ElseIf MainAssetsTable.Category.Years Is Nothing Then
            '    depreciationYears = 0
            'Else
            '    depreciationYears = MainAssetsTable.Category.Years
            'End If
            '' Set result to the desired field value
            'result = If(Not MainAssetsTable.DateAcquired Is Nothing, _
            '       If(depreciationYears > 0 _
            '          , ( _
            '              ( _
            '                  If(MainAssetsTable.AssetAmount > 0 _
            '                     , MainAssetsTable.AssetAmount _
            '                     , If(MainAssetsTable.BaseCost Is Nothing, 0, MainAssetsTable.BaseCost) + If(MainAssetsTable.VAT Is Nothing, 0, MainAssetsTable.VAT)) / depreciationYears) / 12) * DateDiff(DateInterval.Month, CDate(MainAssetsTable.DateAcquired), CDate(If(Not MainAssetsTable.DisposedAsset.DateSold Is Nothing _
            '                                                                                                                                                                                        , MainAssetsTable.DisposedAsset.DateSold _
            '                                                                                                                                                                                        , Now) _
            '                                                                                                                                                                                    ) _
            '                                                                                                                                                                                ) _
            '         , 0) _
            '     , 0)
        End Sub
    End Class

End Namespace
